{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "from statsmodels.stats.multitest import multipletests\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATH = r'D:\\Miguel\\PhD\\Results\\Competition\\DL\\small_arenas\\WT_mating_pairs\\processed'\n",
    "FPS = 60\n",
    "N_MINUTES = 55\n",
    "N_FRAMES = N_MINUTES * 60 * FPS\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='paper',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.0,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [4.0, 4.0],\n",
    "            'figure.titlesize': 30.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.0,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figureS3')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print('New folder created.')\n",
    "except FileExistsError:\n",
    "    print('Folder already exists, skipping.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food', 'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['food', 'no_food']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " food\n",
      "\t\n",
      " no_food\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'food': ['D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena1.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena10.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena11.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena12.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena13.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena14.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena15.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena2.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena3.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena4.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena5.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena6.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena7.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena8.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena9.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena10.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena11.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena12.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena13.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena14.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena15.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena16.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena9.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena2.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena3.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena7.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena8.csv'],\n",
       " 'no_food': ['D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena10.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena11.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena12.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena13.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena14.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena16.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena2.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena3.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena4.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena5.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena7.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena8.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena9.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena1.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena2.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena5.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena7.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena8.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena10.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena11.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena12.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena13.csv',\n",
       "  'D:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena16.csv']}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    \n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "    \n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.name.endswith('.csv'):\n",
    "            \n",
    "            annotation_video = annotations.read(item.path)\n",
    "\n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "\n",
    "                # Filter out videos where copulation is interrupted.\n",
    "                copulation_end = copulation.time_interval[1]\n",
    "                if copulation_end==N_FRAMES:\n",
    "                    print('Copulation interrupted:', item.name)\n",
    "                    continue\n",
    "\n",
    "                # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                copulation_duration = copulation.duration\n",
    "                if copulation_duration <= 8 * 60 * FPS:\n",
    "                    print('Copulation too short:', item.name)\n",
    "                    continue\n",
    "            \n",
    "            except IndexError:\n",
    "                continue\n",
    "            \n",
    "            experiments[condition].append(item.path)\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Aggression Analysis (First 5 Minutes ONLY)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration: 0 \n",
      "Experiment: video_2019-11-27T10_50_09_arena1.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-11-27T10_50_09_arena10.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-11-27T10_50_09_arena11.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-11-27T10_50_09_arena12.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-11-27T10_50_09_arena13.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-11-27T10_50_09_arena14.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-11-27T10_50_09_arena15.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-11-27T10_50_09_arena2.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-11-27T10_50_09_arena3.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-11-27T10_50_09_arena4.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-11-27T10_50_09_arena5.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-11-27T10_50_09_arena6.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-11-27T10_50_09_arena7.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-11-27T10_50_09_arena8.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-11-27T10_50_09_arena9.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-05T11_29_29_arena10.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-05T11_29_29_arena11.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-05T11_29_29_arena12.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-05T11_29_29_arena13.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-05T11_29_29_arena14.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-05T11_29_29_arena15.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-05T11_29_29_arena16.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-05T11_29_29_arena9.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-12-06T10_32_06_arena2.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-12-06T10_32_06_arena3.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-12-06T10_32_06_arena7.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-12-06T10_32_06_arena8.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2019-12-05T10_28_30_arena10.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-12-05T10_28_30_arena11.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-12-05T10_28_30_arena12.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-12-05T10_28_30_arena13.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-12-05T10_28_30_arena14.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-12-05T10_28_30_arena16.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-12-05T10_28_30_arena2.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-12-05T10_28_30_arena3.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-12-05T10_28_30_arena4.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-12-05T10_28_30_arena5.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-12-05T10_28_30_arena7.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-12-05T10_28_30_arena8.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-12-05T10_28_30_arena9.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-12-05T11_29_29_arena1.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-12-05T11_29_29_arena2.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-05T11_29_29_arena5.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-05T11_29_29_arena7.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-05T11_29_29_arena8.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-06T10_32_06_arena10.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-06T10_32_06_arena11.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-06T10_32_06_arena12.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-06T10_32_06_arena13.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-06T10_32_06_arena16.csv \n",
      "Condition: no_food \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>has_food</th>\n",
       "      <th>aggression_latency</th>\n",
       "      <th>aggression_latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1771.0</td>\n",
       "      <td>0.491944</td>\n",
       "      <td>504</td>\n",
       "      <td>5</td>\n",
       "      <td>0.028000</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2032.0</td>\n",
       "      <td>0.564444</td>\n",
       "      <td>2112</td>\n",
       "      <td>13</td>\n",
       "      <td>0.117333</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5507.0</td>\n",
       "      <td>1.529722</td>\n",
       "      <td>1340</td>\n",
       "      <td>11</td>\n",
       "      <td>0.074444</td>\n",
       "      <td>2.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7035.0</td>\n",
       "      <td>1.954167</td>\n",
       "      <td>1784</td>\n",
       "      <td>8</td>\n",
       "      <td>0.099111</td>\n",
       "      <td>1.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5045.0</td>\n",
       "      <td>1.401389</td>\n",
       "      <td>3045</td>\n",
       "      <td>7</td>\n",
       "      <td>0.169167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5699.0</td>\n",
       "      <td>1.583056</td>\n",
       "      <td>172</td>\n",
       "      <td>5</td>\n",
       "      <td>0.009556</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3181.0</td>\n",
       "      <td>0.883611</td>\n",
       "      <td>507</td>\n",
       "      <td>7</td>\n",
       "      <td>0.028167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>478.0</td>\n",
       "      <td>0.132778</td>\n",
       "      <td>2093</td>\n",
       "      <td>13</td>\n",
       "      <td>0.116278</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2534.0</td>\n",
       "      <td>0.703889</td>\n",
       "      <td>1465</td>\n",
       "      <td>9</td>\n",
       "      <td>0.081389</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>906.0</td>\n",
       "      <td>0.251667</td>\n",
       "      <td>991</td>\n",
       "      <td>5</td>\n",
       "      <td>0.055056</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5570.0</td>\n",
       "      <td>1.547222</td>\n",
       "      <td>1129</td>\n",
       "      <td>9</td>\n",
       "      <td>0.062722</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2807.0</td>\n",
       "      <td>0.779722</td>\n",
       "      <td>424</td>\n",
       "      <td>5</td>\n",
       "      <td>0.023556</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena6.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5892.0</td>\n",
       "      <td>1.636667</td>\n",
       "      <td>1092</td>\n",
       "      <td>9</td>\n",
       "      <td>0.060667</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4860.0</td>\n",
       "      <td>1.350000</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000389</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>366.0</td>\n",
       "      <td>0.101667</td>\n",
       "      <td>756</td>\n",
       "      <td>12</td>\n",
       "      <td>0.042000</td>\n",
       "      <td>2.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1739.0</td>\n",
       "      <td>0.483056</td>\n",
       "      <td>615</td>\n",
       "      <td>5</td>\n",
       "      <td>0.034167</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>6810.0</td>\n",
       "      <td>1.891667</td>\n",
       "      <td>187</td>\n",
       "      <td>1</td>\n",
       "      <td>0.010389</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2311.0</td>\n",
       "      <td>0.641944</td>\n",
       "      <td>216</td>\n",
       "      <td>3</td>\n",
       "      <td>0.012000</td>\n",
       "      <td>0.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3917.0</td>\n",
       "      <td>1.088056</td>\n",
       "      <td>1289</td>\n",
       "      <td>10</td>\n",
       "      <td>0.071611</td>\n",
       "      <td>2.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4861.0</td>\n",
       "      <td>1.350278</td>\n",
       "      <td>750</td>\n",
       "      <td>3</td>\n",
       "      <td>0.041667</td>\n",
       "      <td>0.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2780.0</td>\n",
       "      <td>0.772222</td>\n",
       "      <td>1453</td>\n",
       "      <td>14</td>\n",
       "      <td>0.080722</td>\n",
       "      <td>2.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4093.0</td>\n",
       "      <td>1.136944</td>\n",
       "      <td>409</td>\n",
       "      <td>7</td>\n",
       "      <td>0.022722</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4224.0</td>\n",
       "      <td>1.173333</td>\n",
       "      <td>1086</td>\n",
       "      <td>20</td>\n",
       "      <td>0.060333</td>\n",
       "      <td>4.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5927.0</td>\n",
       "      <td>1.646389</td>\n",
       "      <td>13</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000722</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7610.0</td>\n",
       "      <td>2.113889</td>\n",
       "      <td>713</td>\n",
       "      <td>13</td>\n",
       "      <td>0.039611</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5674.0</td>\n",
       "      <td>1.576111</td>\n",
       "      <td>166</td>\n",
       "      <td>4</td>\n",
       "      <td>0.009222</td>\n",
       "      <td>0.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11870.0</td>\n",
       "      <td>3.297222</td>\n",
       "      <td>106</td>\n",
       "      <td>1</td>\n",
       "      <td>0.005889</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11558.0</td>\n",
       "      <td>3.210556</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000444</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>14878.0</td>\n",
       "      <td>4.132778</td>\n",
       "      <td>48</td>\n",
       "      <td>2</td>\n",
       "      <td>0.002667</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>10280.0</td>\n",
       "      <td>2.855556</td>\n",
       "      <td>25</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001389</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>13813.0</td>\n",
       "      <td>3.836944</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000444</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>15484.0</td>\n",
       "      <td>4.301111</td>\n",
       "      <td>56</td>\n",
       "      <td>1</td>\n",
       "      <td>0.003111</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>2509.0</td>\n",
       "      <td>0.696944</td>\n",
       "      <td>35</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001944</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>6592.0</td>\n",
       "      <td>1.831111</td>\n",
       "      <td>51</td>\n",
       "      <td>1</td>\n",
       "      <td>0.002833</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>977.0</td>\n",
       "      <td>0.271389</td>\n",
       "      <td>94</td>\n",
       "      <td>2</td>\n",
       "      <td>0.005222</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11979.0</td>\n",
       "      <td>3.327500</td>\n",
       "      <td>20</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001111</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena16.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  has_food  aggression_latency  aggression_latency_mins  \\\n",
       "0             True      True              1771.0                 0.491944   \n",
       "1             True      True              2032.0                 0.564444   \n",
       "2             True      True              5507.0                 1.529722   \n",
       "3             True      True              7035.0                 1.954167   \n",
       "4             True      True              5045.0                 1.401389   \n",
       "5             True      True              5699.0                 1.583056   \n",
       "6             True      True              3181.0                 0.883611   \n",
       "7             True      True               478.0                 0.132778   \n",
       "8             True      True              2534.0                 0.703889   \n",
       "9             True      True               906.0                 0.251667   \n",
       "10            True      True              5570.0                 1.547222   \n",
       "11            True      True              2807.0                 0.779722   \n",
       "12            True      True              5892.0                 1.636667   \n",
       "13            True      True              4860.0                 1.350000   \n",
       "14            True      True               366.0                 0.101667   \n",
       "15            True      True              1739.0                 0.483056   \n",
       "16            True      True              6810.0                 1.891667   \n",
       "17            True      True              2311.0                 0.641944   \n",
       "18            True      True              3917.0                 1.088056   \n",
       "19            True      True              4861.0                 1.350278   \n",
       "20            True      True              2780.0                 0.772222   \n",
       "21            True      True              4093.0                 1.136944   \n",
       "22            True      True              4224.0                 1.173333   \n",
       "23           False      True                 NaN                 0.000000   \n",
       "24            True      True              5927.0                 1.646389   \n",
       "25            True      True              7610.0                 2.113889   \n",
       "26            True      True              5674.0                 1.576111   \n",
       "27           False     False                 NaN                 0.000000   \n",
       "28            True     False             11870.0                 3.297222   \n",
       "29           False     False                 NaN                 0.000000   \n",
       "30           False     False                 NaN                 0.000000   \n",
       "31            True     False             11558.0                 3.210556   \n",
       "32           False     False                 NaN                 0.000000   \n",
       "33           False     False                 NaN                 0.000000   \n",
       "34           False     False                 NaN                 0.000000   \n",
       "35            True     False             14878.0                 4.132778   \n",
       "36            True     False             10280.0                 2.855556   \n",
       "37            True     False             13813.0                 3.836944   \n",
       "38            True     False             15484.0                 4.301111   \n",
       "39            True     False              2509.0                 0.696944   \n",
       "40           False     False                 NaN                 0.000000   \n",
       "41           False     False                 NaN                 0.000000   \n",
       "42           False     False                 NaN                 0.000000   \n",
       "43            True     False              6592.0                 1.831111   \n",
       "44           False     False                 NaN                 0.000000   \n",
       "45           False     False                 NaN                 0.000000   \n",
       "46            True     False               977.0                 0.271389   \n",
       "47           False     False                 NaN                 0.000000   \n",
       "48            True     False             11979.0                 3.327500   \n",
       "49           False     False                 NaN                 0.000000   \n",
       "\n",
       "    nframes  nbouts  ratio_frames  ratio_bouts condition  \\\n",
       "0       504       5      0.028000          1.0      food   \n",
       "1      2112      13      0.117333          2.6      food   \n",
       "2      1340      11      0.074444          2.2      food   \n",
       "3      1784       8      0.099111          1.6      food   \n",
       "4      3045       7      0.169167          1.4      food   \n",
       "5       172       5      0.009556          1.0      food   \n",
       "6       507       7      0.028167          1.4      food   \n",
       "7      2093      13      0.116278          2.6      food   \n",
       "8      1465       9      0.081389          1.8      food   \n",
       "9       991       5      0.055056          1.0      food   \n",
       "10     1129       9      0.062722          1.8      food   \n",
       "11      424       5      0.023556          1.0      food   \n",
       "12     1092       9      0.060667          1.8      food   \n",
       "13        7       1      0.000389          0.2      food   \n",
       "14      756      12      0.042000          2.4      food   \n",
       "15      615       5      0.034167          1.0      food   \n",
       "16      187       1      0.010389          0.2      food   \n",
       "17      216       3      0.012000          0.6      food   \n",
       "18     1289      10      0.071611          2.0      food   \n",
       "19      750       3      0.041667          0.6      food   \n",
       "20     1453      14      0.080722          2.8      food   \n",
       "21      409       7      0.022722          1.4      food   \n",
       "22     1086      20      0.060333          4.0      food   \n",
       "23        0       0      0.000000          0.0      food   \n",
       "24       13       1      0.000722          0.2      food   \n",
       "25      713      13      0.039611          2.6      food   \n",
       "26      166       4      0.009222          0.8      food   \n",
       "27        0       0      0.000000          0.0   no_food   \n",
       "28      106       1      0.005889          0.2   no_food   \n",
       "29        0       0      0.000000          0.0   no_food   \n",
       "30        0       0      0.000000          0.0   no_food   \n",
       "31        8       1      0.000444          0.2   no_food   \n",
       "32        0       0      0.000000          0.0   no_food   \n",
       "33        0       0      0.000000          0.0   no_food   \n",
       "34        0       0      0.000000          0.0   no_food   \n",
       "35       48       2      0.002667          0.4   no_food   \n",
       "36       25       2      0.001389          0.4   no_food   \n",
       "37        8       1      0.000444          0.2   no_food   \n",
       "38       56       1      0.003111          0.2   no_food   \n",
       "39       35       2      0.001944          0.4   no_food   \n",
       "40        0       0      0.000000          0.0   no_food   \n",
       "41        0       0      0.000000          0.0   no_food   \n",
       "42        0       0      0.000000          0.0   no_food   \n",
       "43       51       1      0.002833          0.2   no_food   \n",
       "44        0       0      0.000000          0.0   no_food   \n",
       "45        0       0      0.000000          0.0   no_food   \n",
       "46       94       2      0.005222          0.4   no_food   \n",
       "47        0       0      0.000000          0.0   no_food   \n",
       "48       20       2      0.001111          0.4   no_food   \n",
       "49        0       0      0.000000          0.0   no_food   \n",
       "\n",
       "                               experiment  \n",
       "0    video_2019-11-27T10_50_09_arena1.csv  \n",
       "1   video_2019-11-27T10_50_09_arena10.csv  \n",
       "2   video_2019-11-27T10_50_09_arena11.csv  \n",
       "3   video_2019-11-27T10_50_09_arena12.csv  \n",
       "4   video_2019-11-27T10_50_09_arena13.csv  \n",
       "5   video_2019-11-27T10_50_09_arena14.csv  \n",
       "6   video_2019-11-27T10_50_09_arena15.csv  \n",
       "7    video_2019-11-27T10_50_09_arena2.csv  \n",
       "8    video_2019-11-27T10_50_09_arena3.csv  \n",
       "9    video_2019-11-27T10_50_09_arena4.csv  \n",
       "10   video_2019-11-27T10_50_09_arena5.csv  \n",
       "11   video_2019-11-27T10_50_09_arena6.csv  \n",
       "12   video_2019-11-27T10_50_09_arena7.csv  \n",
       "13   video_2019-11-27T10_50_09_arena8.csv  \n",
       "14   video_2019-11-27T10_50_09_arena9.csv  \n",
       "15  video_2019-12-05T11_29_29_arena10.csv  \n",
       "16  video_2019-12-05T11_29_29_arena11.csv  \n",
       "17  video_2019-12-05T11_29_29_arena12.csv  \n",
       "18  video_2019-12-05T11_29_29_arena13.csv  \n",
       "19  video_2019-12-05T11_29_29_arena14.csv  \n",
       "20  video_2019-12-05T11_29_29_arena15.csv  \n",
       "21  video_2019-12-05T11_29_29_arena16.csv  \n",
       "22   video_2019-12-05T11_29_29_arena9.csv  \n",
       "23   video_2019-12-06T10_32_06_arena2.csv  \n",
       "24   video_2019-12-06T10_32_06_arena3.csv  \n",
       "25   video_2019-12-06T10_32_06_arena7.csv  \n",
       "26   video_2019-12-06T10_32_06_arena8.csv  \n",
       "27  video_2019-12-05T10_28_30_arena10.csv  \n",
       "28  video_2019-12-05T10_28_30_arena11.csv  \n",
       "29  video_2019-12-05T10_28_30_arena12.csv  \n",
       "30  video_2019-12-05T10_28_30_arena13.csv  \n",
       "31  video_2019-12-05T10_28_30_arena14.csv  \n",
       "32  video_2019-12-05T10_28_30_arena16.csv  \n",
       "33   video_2019-12-05T10_28_30_arena2.csv  \n",
       "34   video_2019-12-05T10_28_30_arena3.csv  \n",
       "35   video_2019-12-05T10_28_30_arena4.csv  \n",
       "36   video_2019-12-05T10_28_30_arena5.csv  \n",
       "37   video_2019-12-05T10_28_30_arena7.csv  \n",
       "38   video_2019-12-05T10_28_30_arena8.csv  \n",
       "39   video_2019-12-05T10_28_30_arena9.csv  \n",
       "40   video_2019-12-05T11_29_29_arena1.csv  \n",
       "41   video_2019-12-05T11_29_29_arena2.csv  \n",
       "42   video_2019-12-05T11_29_29_arena5.csv  \n",
       "43   video_2019-12-05T11_29_29_arena7.csv  \n",
       "44   video_2019-12-05T11_29_29_arena8.csv  \n",
       "45  video_2019-12-06T10_32_06_arena10.csv  \n",
       "46  video_2019-12-06T10_32_06_arena11.csv  \n",
       "47  video_2019-12-06T10_32_06_arena12.csv  \n",
       "48  video_2019-12-06T10_32_06_arena13.csv  \n",
       "49  video_2019-12-06T10_32_06_arena16.csv  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aggression_df = pd.DataFrame()\n",
    "for condition in experiments.keys():\n",
    "    for h, experiment_path in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "        \n",
    "        print('Iteration:', h, '\\nExperiment:', experiment, '\\nCondition:', condition, '\\n')\n",
    "        \n",
    "        # Exclude experiments without copulation (since aggression is only observed during copulation).\n",
    "        annotation_video = annotations.read(experiment_path)\n",
    "        try:\n",
    "            copulation = annotation_video[0].events[0]\n",
    "        except IndexError:\n",
    "            continue\n",
    "        \n",
    "        aggression_events = list(filter(lambda event: event.time < (copulation.time + 18000), annotation_video[1].events)) # Consider aggression only during the first 5 minutes of copulation.\n",
    "        n_events = len(aggression_events)\n",
    "\n",
    "        # In case there is aggression, do the necessary calculations.\n",
    "        if n_events > 0:\n",
    "            \n",
    "            aggression_latency =  aggression_events[0].time - copulation.time\n",
    "            aggression_latency_mins = aggression_latency / (60 * FPS)\n",
    "            \n",
    "            ratio_frames = sum([aggression.duration for aggression in aggression_events]) / (5 * 60 * FPS)\n",
    "            ratio_bouts = n_events / 5\n",
    "            \n",
    "            aggression_data = pd.DataFrame({'has_aggression': True,\n",
    "                                            'has_food': True if condition == 'food' else False,\n",
    "                                            'aggression_latency': aggression_latency,\n",
    "                                            'aggression_latency_mins': aggression_latency_mins,\n",
    "                                            'nframes': sum([aggression.duration for aggression in aggression_events]),\n",
    "                                            'nbouts': n_events,\n",
    "                                            'ratio_frames': ratio_frames,\n",
    "                                            'ratio_bouts': ratio_bouts,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # If not, preset our dictionary with default values.\n",
    "        else:\n",
    "            aggression_data = pd.DataFrame({'has_aggression': False,\n",
    "                                            'has_food': True if condition == 'food' else False,\n",
    "                                            'aggression_latency': np.nan,\n",
    "                                            'aggression_latency_mins': 0,\n",
    "                                            'nframes': 0,\n",
    "                                            'nbouts': 0,\n",
    "                                            'ratio_frames': 0, \n",
    "                                            'ratio_bouts': 0,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # Concatenate all data together.\n",
    "        aggression_df = pd.concat([aggression_df, aggression_data], ignore_index=True)\n",
    "\n",
    "aggression_df = aggression_df[['has_aggression',\n",
    "                               'has_food',\n",
    "                               'aggression_latency',\n",
    "                               'aggression_latency_mins',\n",
    "                               'nframes',\n",
    "                               'nbouts',\n",
    "                               'ratio_frames', \n",
    "                               'ratio_bouts',\n",
    "                               'condition',\n",
    "                               'experiment'\n",
    "                              ]]\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Outlier Detection"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t food \n",
      "\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "\n",
      "\t no_food \n",
      "\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>has_food</th>\n",
       "      <th>aggression_latency</th>\n",
       "      <th>aggression_latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1771.0</td>\n",
       "      <td>0.491944</td>\n",
       "      <td>504</td>\n",
       "      <td>5</td>\n",
       "      <td>0.028000</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2032.0</td>\n",
       "      <td>0.564444</td>\n",
       "      <td>2112</td>\n",
       "      <td>13</td>\n",
       "      <td>0.117333</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5507.0</td>\n",
       "      <td>1.529722</td>\n",
       "      <td>1340</td>\n",
       "      <td>11</td>\n",
       "      <td>0.074444</td>\n",
       "      <td>2.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7035.0</td>\n",
       "      <td>1.954167</td>\n",
       "      <td>1784</td>\n",
       "      <td>8</td>\n",
       "      <td>0.099111</td>\n",
       "      <td>1.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5045.0</td>\n",
       "      <td>1.401389</td>\n",
       "      <td>3045</td>\n",
       "      <td>7</td>\n",
       "      <td>0.169167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5699.0</td>\n",
       "      <td>1.583056</td>\n",
       "      <td>172</td>\n",
       "      <td>5</td>\n",
       "      <td>0.009556</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3181.0</td>\n",
       "      <td>0.883611</td>\n",
       "      <td>507</td>\n",
       "      <td>7</td>\n",
       "      <td>0.028167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>478.0</td>\n",
       "      <td>0.132778</td>\n",
       "      <td>2093</td>\n",
       "      <td>13</td>\n",
       "      <td>0.116278</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2534.0</td>\n",
       "      <td>0.703889</td>\n",
       "      <td>1465</td>\n",
       "      <td>9</td>\n",
       "      <td>0.081389</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>906.0</td>\n",
       "      <td>0.251667</td>\n",
       "      <td>991</td>\n",
       "      <td>5</td>\n",
       "      <td>0.055056</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5570.0</td>\n",
       "      <td>1.547222</td>\n",
       "      <td>1129</td>\n",
       "      <td>9</td>\n",
       "      <td>0.062722</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2807.0</td>\n",
       "      <td>0.779722</td>\n",
       "      <td>424</td>\n",
       "      <td>5</td>\n",
       "      <td>0.023556</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena6.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5892.0</td>\n",
       "      <td>1.636667</td>\n",
       "      <td>1092</td>\n",
       "      <td>9</td>\n",
       "      <td>0.060667</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4860.0</td>\n",
       "      <td>1.350000</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000389</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>366.0</td>\n",
       "      <td>0.101667</td>\n",
       "      <td>756</td>\n",
       "      <td>12</td>\n",
       "      <td>0.042000</td>\n",
       "      <td>2.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1739.0</td>\n",
       "      <td>0.483056</td>\n",
       "      <td>615</td>\n",
       "      <td>5</td>\n",
       "      <td>0.034167</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>6810.0</td>\n",
       "      <td>1.891667</td>\n",
       "      <td>187</td>\n",
       "      <td>1</td>\n",
       "      <td>0.010389</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2311.0</td>\n",
       "      <td>0.641944</td>\n",
       "      <td>216</td>\n",
       "      <td>3</td>\n",
       "      <td>0.012000</td>\n",
       "      <td>0.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3917.0</td>\n",
       "      <td>1.088056</td>\n",
       "      <td>1289</td>\n",
       "      <td>10</td>\n",
       "      <td>0.071611</td>\n",
       "      <td>2.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4861.0</td>\n",
       "      <td>1.350278</td>\n",
       "      <td>750</td>\n",
       "      <td>3</td>\n",
       "      <td>0.041667</td>\n",
       "      <td>0.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2780.0</td>\n",
       "      <td>0.772222</td>\n",
       "      <td>1453</td>\n",
       "      <td>14</td>\n",
       "      <td>0.080722</td>\n",
       "      <td>2.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4093.0</td>\n",
       "      <td>1.136944</td>\n",
       "      <td>409</td>\n",
       "      <td>7</td>\n",
       "      <td>0.022722</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4224.0</td>\n",
       "      <td>1.173333</td>\n",
       "      <td>1086</td>\n",
       "      <td>20</td>\n",
       "      <td>0.060333</td>\n",
       "      <td>4.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5927.0</td>\n",
       "      <td>1.646389</td>\n",
       "      <td>13</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000722</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7610.0</td>\n",
       "      <td>2.113889</td>\n",
       "      <td>713</td>\n",
       "      <td>13</td>\n",
       "      <td>0.039611</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5674.0</td>\n",
       "      <td>1.576111</td>\n",
       "      <td>166</td>\n",
       "      <td>4</td>\n",
       "      <td>0.009222</td>\n",
       "      <td>0.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11870.0</td>\n",
       "      <td>3.297222</td>\n",
       "      <td>106</td>\n",
       "      <td>1</td>\n",
       "      <td>0.005889</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11558.0</td>\n",
       "      <td>3.210556</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000444</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>14878.0</td>\n",
       "      <td>4.132778</td>\n",
       "      <td>48</td>\n",
       "      <td>2</td>\n",
       "      <td>0.002667</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>10280.0</td>\n",
       "      <td>2.855556</td>\n",
       "      <td>25</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001389</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>13813.0</td>\n",
       "      <td>3.836944</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000444</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>15484.0</td>\n",
       "      <td>4.301111</td>\n",
       "      <td>56</td>\n",
       "      <td>1</td>\n",
       "      <td>0.003111</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>2509.0</td>\n",
       "      <td>0.696944</td>\n",
       "      <td>35</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001944</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>6592.0</td>\n",
       "      <td>1.831111</td>\n",
       "      <td>51</td>\n",
       "      <td>1</td>\n",
       "      <td>0.002833</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>977.0</td>\n",
       "      <td>0.271389</td>\n",
       "      <td>94</td>\n",
       "      <td>2</td>\n",
       "      <td>0.005222</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11979.0</td>\n",
       "      <td>3.327500</td>\n",
       "      <td>20</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001111</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena16.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  has_food  aggression_latency  aggression_latency_mins  \\\n",
       "0             True      True              1771.0                 0.491944   \n",
       "1             True      True              2032.0                 0.564444   \n",
       "2             True      True              5507.0                 1.529722   \n",
       "3             True      True              7035.0                 1.954167   \n",
       "4             True      True              5045.0                 1.401389   \n",
       "5             True      True              5699.0                 1.583056   \n",
       "6             True      True              3181.0                 0.883611   \n",
       "7             True      True               478.0                 0.132778   \n",
       "8             True      True              2534.0                 0.703889   \n",
       "9             True      True               906.0                 0.251667   \n",
       "10            True      True              5570.0                 1.547222   \n",
       "11            True      True              2807.0                 0.779722   \n",
       "12            True      True              5892.0                 1.636667   \n",
       "13            True      True              4860.0                 1.350000   \n",
       "14            True      True               366.0                 0.101667   \n",
       "15            True      True              1739.0                 0.483056   \n",
       "16            True      True              6810.0                 1.891667   \n",
       "17            True      True              2311.0                 0.641944   \n",
       "18            True      True              3917.0                 1.088056   \n",
       "19            True      True              4861.0                 1.350278   \n",
       "20            True      True              2780.0                 0.772222   \n",
       "21            True      True              4093.0                 1.136944   \n",
       "22            True      True              4224.0                 1.173333   \n",
       "23           False      True                 NaN                 0.000000   \n",
       "24            True      True              5927.0                 1.646389   \n",
       "25            True      True              7610.0                 2.113889   \n",
       "26            True      True              5674.0                 1.576111   \n",
       "27           False     False                 NaN                 0.000000   \n",
       "28            True     False             11870.0                 3.297222   \n",
       "29           False     False                 NaN                 0.000000   \n",
       "30           False     False                 NaN                 0.000000   \n",
       "31            True     False             11558.0                 3.210556   \n",
       "32           False     False                 NaN                 0.000000   \n",
       "33           False     False                 NaN                 0.000000   \n",
       "34           False     False                 NaN                 0.000000   \n",
       "35            True     False             14878.0                 4.132778   \n",
       "36            True     False             10280.0                 2.855556   \n",
       "37            True     False             13813.0                 3.836944   \n",
       "38            True     False             15484.0                 4.301111   \n",
       "39            True     False              2509.0                 0.696944   \n",
       "40           False     False                 NaN                 0.000000   \n",
       "41           False     False                 NaN                 0.000000   \n",
       "42           False     False                 NaN                 0.000000   \n",
       "43            True     False              6592.0                 1.831111   \n",
       "44           False     False                 NaN                 0.000000   \n",
       "45           False     False                 NaN                 0.000000   \n",
       "46            True     False               977.0                 0.271389   \n",
       "47           False     False                 NaN                 0.000000   \n",
       "48            True     False             11979.0                 3.327500   \n",
       "49           False     False                 NaN                 0.000000   \n",
       "\n",
       "    nframes  nbouts  ratio_frames  ratio_bouts condition  \\\n",
       "0       504       5      0.028000          1.0      food   \n",
       "1      2112      13      0.117333          2.6      food   \n",
       "2      1340      11      0.074444          2.2      food   \n",
       "3      1784       8      0.099111          1.6      food   \n",
       "4      3045       7      0.169167          1.4      food   \n",
       "5       172       5      0.009556          1.0      food   \n",
       "6       507       7      0.028167          1.4      food   \n",
       "7      2093      13      0.116278          2.6      food   \n",
       "8      1465       9      0.081389          1.8      food   \n",
       "9       991       5      0.055056          1.0      food   \n",
       "10     1129       9      0.062722          1.8      food   \n",
       "11      424       5      0.023556          1.0      food   \n",
       "12     1092       9      0.060667          1.8      food   \n",
       "13        7       1      0.000389          0.2      food   \n",
       "14      756      12      0.042000          2.4      food   \n",
       "15      615       5      0.034167          1.0      food   \n",
       "16      187       1      0.010389          0.2      food   \n",
       "17      216       3      0.012000          0.6      food   \n",
       "18     1289      10      0.071611          2.0      food   \n",
       "19      750       3      0.041667          0.6      food   \n",
       "20     1453      14      0.080722          2.8      food   \n",
       "21      409       7      0.022722          1.4      food   \n",
       "22     1086      20      0.060333          4.0      food   \n",
       "23        0       0      0.000000          0.0      food   \n",
       "24       13       1      0.000722          0.2      food   \n",
       "25      713      13      0.039611          2.6      food   \n",
       "26      166       4      0.009222          0.8      food   \n",
       "27        0       0      0.000000          0.0   no_food   \n",
       "28      106       1      0.005889          0.2   no_food   \n",
       "29        0       0      0.000000          0.0   no_food   \n",
       "30        0       0      0.000000          0.0   no_food   \n",
       "31        8       1      0.000444          0.2   no_food   \n",
       "32        0       0      0.000000          0.0   no_food   \n",
       "33        0       0      0.000000          0.0   no_food   \n",
       "34        0       0      0.000000          0.0   no_food   \n",
       "35       48       2      0.002667          0.4   no_food   \n",
       "36       25       2      0.001389          0.4   no_food   \n",
       "37        8       1      0.000444          0.2   no_food   \n",
       "38       56       1      0.003111          0.2   no_food   \n",
       "39       35       2      0.001944          0.4   no_food   \n",
       "40        0       0      0.000000          0.0   no_food   \n",
       "41        0       0      0.000000          0.0   no_food   \n",
       "42        0       0      0.000000          0.0   no_food   \n",
       "43       51       1      0.002833          0.2   no_food   \n",
       "44        0       0      0.000000          0.0   no_food   \n",
       "45        0       0      0.000000          0.0   no_food   \n",
       "46       94       2      0.005222          0.4   no_food   \n",
       "47        0       0      0.000000          0.0   no_food   \n",
       "48       20       2      0.001111          0.4   no_food   \n",
       "49        0       0      0.000000          0.0   no_food   \n",
       "\n",
       "                               experiment  \n",
       "0    video_2019-11-27T10_50_09_arena1.csv  \n",
       "1   video_2019-11-27T10_50_09_arena10.csv  \n",
       "2   video_2019-11-27T10_50_09_arena11.csv  \n",
       "3   video_2019-11-27T10_50_09_arena12.csv  \n",
       "4   video_2019-11-27T10_50_09_arena13.csv  \n",
       "5   video_2019-11-27T10_50_09_arena14.csv  \n",
       "6   video_2019-11-27T10_50_09_arena15.csv  \n",
       "7    video_2019-11-27T10_50_09_arena2.csv  \n",
       "8    video_2019-11-27T10_50_09_arena3.csv  \n",
       "9    video_2019-11-27T10_50_09_arena4.csv  \n",
       "10   video_2019-11-27T10_50_09_arena5.csv  \n",
       "11   video_2019-11-27T10_50_09_arena6.csv  \n",
       "12   video_2019-11-27T10_50_09_arena7.csv  \n",
       "13   video_2019-11-27T10_50_09_arena8.csv  \n",
       "14   video_2019-11-27T10_50_09_arena9.csv  \n",
       "15  video_2019-12-05T11_29_29_arena10.csv  \n",
       "16  video_2019-12-05T11_29_29_arena11.csv  \n",
       "17  video_2019-12-05T11_29_29_arena12.csv  \n",
       "18  video_2019-12-05T11_29_29_arena13.csv  \n",
       "19  video_2019-12-05T11_29_29_arena14.csv  \n",
       "20  video_2019-12-05T11_29_29_arena15.csv  \n",
       "21  video_2019-12-05T11_29_29_arena16.csv  \n",
       "22   video_2019-12-05T11_29_29_arena9.csv  \n",
       "23   video_2019-12-06T10_32_06_arena2.csv  \n",
       "24   video_2019-12-06T10_32_06_arena3.csv  \n",
       "25   video_2019-12-06T10_32_06_arena7.csv  \n",
       "26   video_2019-12-06T10_32_06_arena8.csv  \n",
       "27  video_2019-12-05T10_28_30_arena10.csv  \n",
       "28  video_2019-12-05T10_28_30_arena11.csv  \n",
       "29  video_2019-12-05T10_28_30_arena12.csv  \n",
       "30  video_2019-12-05T10_28_30_arena13.csv  \n",
       "31  video_2019-12-05T10_28_30_arena14.csv  \n",
       "32  video_2019-12-05T10_28_30_arena16.csv  \n",
       "33   video_2019-12-05T10_28_30_arena2.csv  \n",
       "34   video_2019-12-05T10_28_30_arena3.csv  \n",
       "35   video_2019-12-05T10_28_30_arena4.csv  \n",
       "36   video_2019-12-05T10_28_30_arena5.csv  \n",
       "37   video_2019-12-05T10_28_30_arena7.csv  \n",
       "38   video_2019-12-05T10_28_30_arena8.csv  \n",
       "39   video_2019-12-05T10_28_30_arena9.csv  \n",
       "40   video_2019-12-05T11_29_29_arena1.csv  \n",
       "41   video_2019-12-05T11_29_29_arena2.csv  \n",
       "42   video_2019-12-05T11_29_29_arena5.csv  \n",
       "43   video_2019-12-05T11_29_29_arena7.csv  \n",
       "44   video_2019-12-05T11_29_29_arena8.csv  \n",
       "45  video_2019-12-06T10_32_06_arena10.csv  \n",
       "46  video_2019-12-06T10_32_06_arena11.csv  \n",
       "47  video_2019-12-06T10_32_06_arena12.csv  \n",
       "48  video_2019-12-06T10_32_06_arena13.csv  \n",
       "49  video_2019-12-06T10_32_06_arena16.csv  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "corrected_ratio_frames = pd.DataFrame()\n",
    "\n",
    "for condition in condition_order:\n",
    "\n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        dataset = aggression_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "        outlier_positions = helpers.check_outliers(dataset)\n",
    "        print(outlier_positions)\n",
    "\n",
    "        fresh_dataset = pd.DataFrame(helpers.remove_outliers(dataset, indices=outlier_positions))\n",
    "        fresh_dataset['condition'] = condition\n",
    "\n",
    "        corrected_ratio_frames = pd.concat([corrected_ratio_frames, fresh_dataset], axis=0)\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "\n",
    "aggression_df = aggression_df.loc[corrected_ratio_frames.index]\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aggression Bouts / Min."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>has_food</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2.2</td>\n",
       "      <td>food</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.6</td>\n",
       "      <td>food</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   ratio_bouts condition  has_food\n",
       "0          1.0      food      True\n",
       "1          2.6      food      True\n",
       "2          2.2      food      True\n",
       "3          1.6      food      True\n",
       "4          1.4      food      True"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_bouts_df = aggression_df.copy()[['ratio_bouts', 'condition', 'has_food']]\n",
    "ratio_bouts_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t no_food \n",
      "\n",
      "Shapiro's Test: group 1 IS normally distributed.\n",
      "D'Agostino's Test: group 1 IS normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.000006\n",
      "  All groups were sampled from populations with NOT IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 4.356698097461346e-08 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'no_food': 4.356698097461346e-08}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_bouts_pvalues = {}\n",
    "\n",
    "control = ratio_bouts_df.query('condition==\"food\"')['ratio_bouts']\n",
    "\n",
    "for condition in condition_order[1:]:\n",
    "\n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        test = ratio_bouts_df.query('condition==\"' + condition + '\"')['ratio_bouts']\n",
    "\n",
    "        temp_values = {'control': control, 'test': test}\n",
    "\n",
    "        pvalue_condition = helpers.run_statistics(temp_values)\n",
    "\n",
    "        ratio_bouts_pvalues[condition] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "    \n",
    "ratio_bouts_pvalues"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "no_food\n",
      "Large Efect: -1.0 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'no_food': -1.0}"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_bouts_effect_sizes = {}\n",
    "\n",
    "control = ratio_bouts_df.query('condition==\"food\"')['ratio_bouts']\n",
    "\n",
    "for condition in condition_order[1:]:\n",
    "    \n",
    "    print(condition)\n",
    "    \n",
    "    test = ratio_bouts_df.query('condition==\"' + condition +'\"')['ratio_bouts']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "\n",
    "    ratio_bouts_effect_sizes[condition] = median_diff\n",
    "    \n",
    "ratio_bouts_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALgAAAEgCAYAAAAHcbldAAAABHN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FYNsLgAotGGFxg0QiDCywaYXCBRSMMLrBohMEFFo0wuMCiEQYXWDTC4AKL5v8BzB2jXSH/h3kAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 180x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = ratio_bouts_df['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='condition',\n",
    "            y='ratio_bouts',\n",
    "            data=ratio_bouts_df,\n",
    "            order=condition_order,\n",
    "            palette=['steelblue', '#5e6472'],\n",
    "            width=0.6,\n",
    "            showfliers=False,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='condition',\n",
    "              y='ratio_bouts',\n",
    "              data=ratio_bouts_df,\n",
    "              order=condition_order,\n",
    "              palette=['steelblue', '#5e6472'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('# Bouts / Minute of Copulation')\n",
    "axis.set_ylim(0, 5)\n",
    "axis.set_yticks(np.arange(0, 5+0.5, 1))\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(ratio_bouts_df.query('condition==\"'+condition+'\"').shape[0]) for condition in condition_order]\n",
    "row2 = ['With\\nfood', 'Without\\nfood']\n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='center',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical result.\n",
    "for p, condition in enumerate(condition_order[1:]):\n",
    "    sig_height = 6 if (ratio_bouts_pvalues.get(condition, 'NaN') == 'NaN') or (ratio_bouts_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p+1,\n",
    "                                 x2=p+1,\n",
    "                                 p_value=ratio_bouts_pvalues.get(condition, 'NaN'),\n",
    "                                 y=4.5,\n",
    "                                 ticksize=0,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'nbouts_aggression_normalized_first_5mins'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
